package day1.homework;

import java.io.File;
import java.util.Scanner;

public
class demo2 {
    public static
    void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("文件夹路径：");
        String path = sc.nextLine();
        File f = new File(path);
        if (f.exists()) {
            System.out.println("文件夹存在");
            System.out.println("文件夹下的所有.java后缀的文件名：");
            String[] list = f.list((dir, name) -> name.endsWith(".java"));
            for (String s : list) {
                System.out.println(s);
            }
        }else {
            System.out.println("文件夹不存在");
        }
    }
}